package com.example.service;

import com.example.mapper.UserMapper;
import com.example.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class UserService {

    @Autowired
    private UserMapper userMapper;


    public List<User> findAll() {
        return userMapper.findAll();
    }

    public void addUser(User users) {
        userMapper.addUser(users);
    }

    public void delete(Integer id) {
        userMapper.delete(id);
    }

    public User findById(Integer id) {
        return userMapper.findById(id);
    }

    public void update(User user,Integer id) {
        String name = user.getName();
        Date time = user.getTime();
        String password = user.getPassword();
        String sex = user.getSex();
        userMapper.update(name,id,time,password,sex);
    }
}
